package org.remas.util;

import java.io.File;

/**
 * User: Winarto
 * Date: Sep 26, 2009
 * Time: 2:42:26 AM
 */
public class FileUtils {
	/**
	 * Delete a file or directory recursively
	 * @param path file or directory to be deleted
	 * @return true if path is deleted.
	 */
	public static boolean deleteFile(File path) {
		if (path != null && path.exists()) {
			if (path.isDirectory()) {
				File[] files = path.listFiles();
				for (File file : files) {
					deleteFile(file);
				}
			}
			return path.delete();
		}
		return false;
	}
}
